<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>学生个人信息</title>
    <link rel="shortcut icon" href="../../image/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="../../css/main.css" media="all">
    <link rel="stylesheet" href="../../css/student.css">
    <script type="text/html" id="infotpl">
        <img class="layui-form-item stu-imgs" src="../../imgs/tx001.jpg">
        <div class="stu-info-box" id="stu-intentional">
                    <span><i class="layui-icon"
                             style="font-size:20px;color: #1c0202;">&#xe66f;</i><b>&nbsp;&nbsp;姓名：</b></span><span>{{d.realname}}</span><br/>
            <span><i class="layui-icon"
                     style="font-size:20px;color: #1c0202;">&#xe66e;</i><b>&nbsp;&nbsp;专业：</b></span><span>{{d.clzaa.profession.professionname || ''}}</span><br/>
            <span><i class="layui-icon"
                     style="font-size:20px;color: #1c0202;">&#xe60e;</i><b>&nbsp;&nbsp;年龄：</b></span><span>{{d.dateofbirth}}</span><br/>
            <span><i class="layui-icon"
                     style="font-size:20px;color: #1c0202;">&#xe63b;</i><b>&nbsp;&nbsp;手机：</b></span><span>{{d.phonenumber}}</span><br/>
            <span><i class="layui-icon"
                     style="font-size:20px;color: #1c0202;">&#xe628;</i><b>&nbsp;&nbsp;身份证：</b></span><span>{{d.idnumber}}</span><br/>
        </div>
    </script>
</head>
<body>

<div class="layui-layout layui-layout-admin">
    <!-- 内容   -->
    <div class="layui-container">
        <div class="layui-card" style="margin-top: 15px">
            <div class="layui-card-header"><b style="font-size: 18px">个人信息</b></div>
            <div class="layui-card-body" id="infocontent">
                <!--   个人信息  -->
            </div>
        </div>
    </div>
</div>
</body>
<script src="../../libs/layui/layui.js"></script>
<script>
    layui.use(['layer', 'jquery', 'laytpl', 'okLayer'], function () {
        let layer = layui.layer;
        let $ = layui.jquery;
        let laytpl = layui.laytpl;
        let okLayer = layui.okLayer;
        // 获取contentText
        const ctx = function () {
            let pathName = document.location.pathname;
            let index = pathName.substr(1).indexOf("/");
            let result = pathName.substr(0, index + 1);
            return result;
        }();
        // 获取student
        var student = JSON.parse(window.sessionStorage.getItem("student"));
        laodstuinfo();

        //加载学生信息
        function laodstuinfo() {
            var index;
            $.ajax({
                url: ctx + "/ygssecs/getstudetailinfo",
                type: "GET",
                data: {stuid: student.stuid},
                dataType: "JSON",
                beforeSend: function () {
                    index = layer.load();
                }
            }).done(function (res) {
                if (res.code == 200) {
                    var stu = res.data;
                    var pinfotpl = document.getElementById('infotpl').innerHTML;
                    //开始渲染
                    laytpl(pinfotpl).render(stu, function (html) {
                        document.getElementById('infocontent').innerHTML = html;
                    });
                    layer.close(index);
                } else {
                    okLayer.yellowSighMsg(res.msg)
                }
            }).fail(function (error) {
                console.log(error)
            })
        }

    });
</script>
</html>